<template>
  <div class="tools-wrapper">
    <h2 class="tools-title">常用工具</h2>
    <div class="tools-container">
      <div class="tool-block" @click="goTo('tools-genPass')">
        <span class="tool-icon">🔑</span>
        <span>随机生成密码</span>
      </div>
      <div class="tool-block" @click="goTo('tools-done')">
        <span class="tool-icon">📝</span>
        <span>已办待办</span>
      </div>
      <div class="tool-block" @click="goTo('tools-uploadfile')">
        <span class="tool-icon">🧩</span>
        <span>上传文件</span>
      </div>
      <div class="tool-block" @click="goTo('tools-startup')">
        <span class="tool-icon">⚙️</span>
        <span>一键启动</span>
      </div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
const router = useRouter()
function goTo(name) {
  const pathMap = {
    'tools-genPass': '/tools/subpage1',
    'tools-done': '/tools/subpage2',
    'tools-uploadfile': '/tools/uploadfile',
    'tools-startup': '/tools/startup'
  };
  router.push(pathMap[name] || '/tools');
}
</script>

<style scoped>
.tools-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 0 0 0;
}
.tools-title {
  text-align: center;
  font-size: 28px;
  font-weight: bold;
  margin-bottom: 36px;
  letter-spacing: 2px;
}
.tools-container {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  justify-content: center;
}
.tool-block {
  flex: 1 1 180px;
  min-width: 180px;
  max-width: 220px;
  background: linear-gradient(135deg, #f5faff 60%, #e0eaff 100%);
  border-radius: 14px;
  padding: 48px 0 32px 0;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 2px 12px 0 rgba(0,0,0,0.06);
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.tool-block:hover {
  background: linear-gradient(135deg, #e0eaff 60%, #f5faff 100%);
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 6px 24px 0 rgba(0,0,0,0.12);
}
.tool-icon {
  font-size: 36px;
  margin-bottom: 8px;
  display: block;
}
@media (max-width: 700px) {
  .tools-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 18px;
    padding: 0 8px;
  }
}
</style>